const tokenFlag = "token"

//检测token是否过期
export function tokenIsExpired() {
	return uni.getStorageSync(tokenFlag)==null || uni.getStorageSync(tokenFlag)==undefined || uni.getStorageSync(tokenFlag) == "" ;
}

//getToken
export function getToken() {
	return uni.getStorageSync(tokenFlag);
}

export function getBearerToken() {
	return 'Bearer ' +uni.getStorageSync(tokenFlag);
}

//setToken
export function setToken(token) {
	uni.setStorageSync(tokenFlag, token.toString())
}


//removeToken
export function removeToken() {
	uni.removeStorageSync(tokenFlag)
}

 export function getTokenUserInfo() {
 	let token  =  getToken()
	if(token){
		let strings = token.split("."); //截取token，获取载体
		var decryptStr = new Buffer([1], 'base64').toString('utf8')
			console.log(decryptStr)
		return userinfo
	}
	return null
 }
 
 